package org.chickymate.server.controller.command.dto;

import java.util.ArrayList;
import java.util.List;

import org.chickymate.client.model.ImageDTO;
import org.chickymate.server.model.Image;

public class GetPopularImagesCommand extends DTOAbstractCommand{

	public List<ImageDTO> execute() {
		return asDTO(getCommentDao().getImagesUrls());
	}
	
	private List<ImageDTO> asDTO(List<Image> images) {
		List<ImageDTO> imageDTOs = new ArrayList<ImageDTO>(images.size());
		for(Image image : images) {
			imageDTOs.add(image.asDTO());
		}
		return imageDTOs;
	}

}
